import { Base } from '../../utils/base.js';

class ycOrderdetail extends Base {
  constructor() {
    super();
  }

  getQuery(oid, callBack) {
    var param = {
      url: 'getQuery?oid=' + oid,
      sCallBack: function (data) {
        // console.log(data)
        callBack && callBack(data);
      }
    };
    this.request(param);
  }

  getUserInfo(oid, callBack) {
    var param = {
      url: 'getUserInfo?oid=' + oid,
      sCallBack: function (data) {
        callBack && callBack(data);
      }
    };
    this.request(param);
  }

  execPay(orderID, callBack) {
    var param = {
      url: 'pay/pre_order',
      type: 'post',
      data: {
        id: orderID
      },
      sCallBack: function (res) {
        //console.log(res)
        var timeStamp = res.timeStamp;

        if (timeStamp) {
          //可以支付
          tt.requestPayment({
            'timeStamp': timeStamp.toString(),
            'nonceStr': res.nonceStr,
            'package': res.package,
            'signType': res.signType,
            'paySign': res.paySign,
            success: function (res) {
              //console.log(res)
              callBack && callBack(1);
            },
            fail: function () {
              callBack && callBack(0);
            }
          });
        } else {
          callBack && callBack(0);
        }
      }
    };
    this.request(param);
  }

  getStatus(oid, callBack) {
    var param = {
      url: 'getStatus?oid=' + oid,
      sCallBack: function (data) {
        callBack && callBack(data);
      }
    };
    this.request(param);
  }

  getBuKuan(aid, callBack) {
    var param = {
      url: 'getBuKuan?aid=' + aid,
      sCallBack: function (data) {
        callBack && callBack(data);
      }
    };
    this.request(param);
  }

  gettuikuan(oid, callBack) {
    var param = {
      url: 'gettuikuan?oid=' + oid,
      sCallBack: function (data) {
        callBack && callBack(data);
      }
    };
    this.request(param);
  }

  gettuikuan1(oid, callBack) {
    var param = {
      url: 'gettuikuan1?oid=' + oid,
      sCallBack: function (data) {
        callBack && callBack(data);
      }
    };
    this.request(param);
  } //大麦二维码


  getdamai(oid, callBack) {
    var param = {
      url: 'getdamai?oid=' + oid,
      sCallBack: function (data) {
        callBack && callBack(data);
      }
    };
    this.request(param);
  } //二维码


  getewm(oid, callBack) {
    var param = {
      url: 'getewm?oid=' + oid,
      sCallBack: function (data) {
        callBack && callBack(data);
      }
    };
    this.request(param);
  }

  getaid(oid, callBack) {
    var param = {
      url: 'getaid?oid=' + oid,
      sCallBack: function (data) {
        callBack && callBack(data);
      }
    };
    this.request(param);
  }

}

export { ycOrderdetail };